# _*_ coding: utf-8 _*_
# Licensed under the Apache License, Version 2.0 (the "License")
# main function
# Author: MiqroEra Shibo

from chat_func import chat_with_user
from chat_func import score_and_sort_entities
from chat_func import summarize_web_pages
from chat_func import ner_user_input
from chat_func import bing_search_entities

# 编写主程序
if __name__ == "__main__":
    print("欢迎使用我的demo！请在下面输入一些内容。")
    user_input = input("你：")
    reply = chat_with_user(user_input)
    print("AI：" + reply)
    entities = ner_user_input(user_input)
    print("实体识别结果：")
    for entity in entities:
        print(entity)
    sorted_entities = score_and_sort_entities(user_input, entities)
    print("权重打分和排序结果：")
    for entity, score in sorted_entities:
        print(entity, score)
    web_urls = bing_search_entities(sorted_entities)
    print("必应搜索结果：")
    for web_url in web_urls:
        print(web_url)

    summaries = summarize_web_pages(web_urls)
    print("网页摘要结果：")
    for summary in summaries:
        print(summary)

    print("感谢你使用我的demo！如果你想结束程序，请输入“再见”。")
